home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / libexec / kernel / lilo-del.pl next >
Encoding:
Perl Script  |  1999-08-10  |  691 b   |  32 lines

  1. #!/usr/bin/perl
  2. # $Id: lilo-del.pl,v 1.6 1999/07/22 11:11:19 duwe Exp $
  3.  
  4. $delimage = "\Q$ARGV[0]";
  5.  
  6. open (ELC, "</etc/lilo.conf") || die;
  7.  
  8. $elc = "";
  9.  
  10. $i = 0;
  11.  
  12. # read /etc/lilo.conf line by line, assembling it into "entries"
  13. while (<ELC>) {
  14.   m/^\s*(?:image|other)\s*=/ && $i++; # advance to a new entry
  15.   $elc[$i] .= $_;
  16. }
  17. close ELC;
  18.  
  19. $secret = "no";
  20.  
  21. # Now write out all entries but the ones that reference the named kernel.
  22. while (@elc) {
  23.   if ($elc[0] !~
  24.       m,^\s*image\s*=\s*/boot/vmlinuz(?:-pc97)?-$delimage-modular\s,sm) {
  25.     print $elc[0];
  26.     ($elc[0] =~ m,^\s*password\s*=,sim) && ($secret = "yes");
  27.   }
  28.   shift @elc;
  29. }
  30.  
  31. chmod 0600, "/proc/self/fd/1" unless ($secret eq "no");
  32.